package com.ruoyi.mall.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.PrimaryKeyIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.OrderProductAssociationMapper;
import com.ruoyi.mall.domain.OrderProductAssociation;
import com.ruoyi.mall.service.IOrderProductAssociationService;

/**
 * 订单-产品关联Service业务层处理
 * 
 * @author luogongquan
 * @date 2024-10-18
 */
@Service
public class OrderProductAssociationServiceImpl implements IOrderProductAssociationService 
{
    @Autowired
    private OrderProductAssociationMapper orderProductAssociationMapper;

    /**
     * 查询订单-产品关联
     * 
     * @param id 订单-产品关联主键
     * @return 订单-产品关联
     */
    @Override
    public OrderProductAssociation selectOrderProductAssociationById(Long id)
    {
        return orderProductAssociationMapper.selectOrderProductAssociationById(id);
    }

    /**
     * 查询订单-产品关联列表
     * 
     * @param orderProductAssociation 订单-产品关联
     * @return 订单-产品关联
     */
    @Override
    public List<OrderProductAssociation> selectOrderProductAssociationList(OrderProductAssociation orderProductAssociation)
    {
        return orderProductAssociationMapper.selectOrderProductAssociationList(orderProductAssociation);
    }

    /**
     * 新增订单-产品关联
     * 
     * @param orderProductAssociation 订单-产品关联
     * @return 结果
     */
    @Override
    public int insertOrderProductAssociation(OrderProductAssociation orderProductAssociation)
    {
        orderProductAssociation.setId(PrimaryKeyIdUtils.getSysIdWorker().nextId());
        orderProductAssociation.setCreateTime(DateUtils.getNowDate());
        return orderProductAssociationMapper.insertOrderProductAssociation(orderProductAssociation);
    }

    /**
     * 修改订单-产品关联
     * 
     * @param orderProductAssociation 订单-产品关联
     * @return 结果
     */
    @Override
    public int updateOrderProductAssociation(OrderProductAssociation orderProductAssociation)
    {
        return orderProductAssociationMapper.updateOrderProductAssociation(orderProductAssociation);
    }

    /**
     * 批量删除订单-产品关联
     * 
     * @param ids 需要删除的订单-产品关联主键
     * @return 结果
     */
    @Override
    public int deleteOrderProductAssociationByIds(Long[] ids)
    {
        return orderProductAssociationMapper.deleteOrderProductAssociationByIds(ids);
    }

    /**
     * 删除订单-产品关联信息
     * 
     * @param id 订单-产品关联主键
     * @return 结果
     */
    @Override
    public int deleteOrderProductAssociationById(Long id)
    {
        return orderProductAssociationMapper.deleteOrderProductAssociationById(id);
    }
}
